3.2.24 \(\int \cos (a+b x) \cot (a+b x) \, dx\) [124]

Optimal. Leaf size=23 \[ -\frac {\tanh ^{-1}(\cos (a+b x))}{b}+\frac {\cos (a+b x)}{b} \]

[Out]

-arctanh(cos(b*x+a))/b+cos(b*x+a)/b

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 23, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {2672, 327, 212} \begin {gather*} \frac {\cos (a+b x)}{b}-\frac {\tanh ^{-1}(\cos (a+b x))}{b} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[a + b*x]*Cot[a + b*x],x]

[Out]

-(ArcTanh[Cos[a + b*x]]/b) + Cos[a + b*x]/b

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2672

Int[((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> With[{ff = FreeFactors[S
in[e + f*x], x]}, Dist[ff/f, Subst[Int[(ff*x)^(m + n)/(a^2 - ff^2*x^2)^((n + 1)/2), x], x, a*(Sin[e + f*x]/ff)
], x]] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1)/2]

Rubi steps

\begin {align*} \int \cos (a+b x) \cot (a+b x) \, dx &=-\frac {\text {Subst}\left (\int \frac {x^2}{1-x^2} \, dx,x,\cos (a+b x)\right )}{b}\\ &=\frac {\cos (a+b x)}{b}-\frac {\text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\cos (a+b x)\right )}{b}\\ &=-\frac {\tanh ^{-1}(\cos (a+b x))}{b}+\frac {\cos (a+b x)}{b}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 42, normalized size = 1.83 \begin {gather*} \frac {\cos (a+b x)}{b}-\frac {\log \left (\cos \left (\frac {1}{2} (a+b x)\right )\right )}{b}+\frac {\log \left (\sin \left (\frac {1}{2} (a+b x)\right )\right )}{b} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[a + b*x]*Cot[a + b*x],x]

[Out]

Cos[a + b*x]/b - Log[Cos[(a + b*x)/2]]/b + Log[Sin[(a + b*x)/2]]/b

________________________________________________________________________________________

Maple [A]
time = 0.04, size = 28, normalized size = 1.22

method result size
derivativedivides \(\frac {\cos \left (b x +a \right )+\ln \left (\csc \left (b x +a \right )-\cot \left (b x +a \right )\right )}{b}\) \(28\)
default \(\frac {\cos \left (b x +a \right )+\ln \left (\csc \left (b x +a \right )-\cot \left (b x +a \right )\right )}{b}\) \(28\)
norman \(-\frac {2 \left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{b \left (1+\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}+\frac {\ln \left (\tan \left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{b}\) \(47\)
risch \(\frac {{\mathrm e}^{i \left (b x +a \right )}}{2 b}+\frac {{\mathrm e}^{-i \left (b x +a \right )}}{2 b}+\frac {\ln \left ({\mathrm e}^{i \left (b x +a \right )}-1\right )}{b}-\frac {\ln \left ({\mathrm e}^{i \left (b x +a \right )}+1\right )}{b}\) \(63\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(b*x+a)^2/sin(b*x+a),x,method=_RETURNVERBOSE)

[Out]

1/b*(cos(b*x+a)+ln(csc(b*x+a)-cot(b*x+a)))

________________________________________________________________________________________

Maxima [A]
time = 0.29, size = 34, normalized size = 1.48 \begin {gather*} \frac {2 \, \cos \left (b x + a\right ) - \log \left (\cos \left (b x + a\right ) + 1\right ) + \log \left (\cos \left (b x + a\right ) - 1\right )}{2 \, b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(b*x+a)^2/sin(b*x+a),x, algorithm="maxima")

[Out]

1/2*(2*cos(b*x + a) - log(cos(b*x + a) + 1) + log(cos(b*x + a) - 1))/b

________________________________________________________________________________________

Fricas [A]
time = 0.38, size = 38, normalized size = 1.65 \begin {gather*} \frac {2 \, \cos \left (b x + a\right ) - \log \left (\frac {1}{2} \, \cos \left (b x + a\right ) + \frac {1}{2}\right ) + \log \left (-\frac {1}{2} \, \cos \left (b x + a\right ) + \frac {1}{2}\right )}{2 \, b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(b*x+a)^2/sin(b*x+a),x, algorithm="fricas")

[Out]

1/2*(2*cos(b*x + a) - log(1/2*cos(b*x + a) + 1/2) + log(-1/2*cos(b*x + a) + 1/2))/b

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 92 vs. \(2 (17) = 34\).
time = 0.44, size = 92, normalized size = 4.00 \begin {gather*} \begin {cases} \frac {\log {\left (\tan {\left (\frac {a}{2} + \frac {b x}{2} \right )} \right )} \tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )}}{b \tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + b} + \frac {\log {\left (\tan {\left (\frac {a}{2} + \frac {b x}{2} \right )} \right )}}{b \tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + b} + \frac {2}{b \tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + b} & \text {for}\: b \neq 0 \\\frac {x \cos ^{2}{\left (a \right )}}{\sin {\left (a \right )}} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(b*x+a)**2/sin(b*x+a),x)

[Out]

Piecewise((log(tan(a/2 + b*x/2))*tan(a/2 + b*x/2)**2/(b*tan(a/2 + b*x/2)**2 + b) + log(tan(a/2 + b*x/2))/(b*ta
n(a/2 + b*x/2)**2 + b) + 2/(b*tan(a/2 + b*x/2)**2 + b), Ne(b, 0)), (x*cos(a)**2/sin(a), True))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 57 vs. \(2 (23) = 46\).
time = 4.25, size = 57, normalized size = 2.48 \begin {gather*} -\frac {\frac {4}{\frac {\cos \left (b x + a\right ) - 1}{\cos \left (b x + a\right ) + 1} - 1} - \log \left (\frac {{\left | -\cos \left (b x + a\right ) + 1 \right |}}{{\left | \cos \left (b x + a\right ) + 1 \right |}}\right )}{2 \, b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(b*x+a)^2/sin(b*x+a),x, algorithm="giac")

[Out]

-1/2*(4/((cos(b*x + a) - 1)/(cos(b*x + a) + 1) - 1) - log(abs(-cos(b*x + a) + 1)/abs(cos(b*x + a) + 1)))/b

________________________________________________________________________________________

Mupad [B]
time = 0.46, size = 35, normalized size = 1.52 \begin {gather*} \frac {2}{b\,\left ({\mathrm {tan}\left (\frac {a}{2}+\frac {b\,x}{2}\right )}^2+1\right )}+\frac {\ln \left (\mathrm {tan}\left (\frac {a}{2}+\frac {b\,x}{2}\right )\right )}{b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(a + b*x)^2/sin(a + b*x),x)

[Out]

2/(b*(tan(a/2 + (b*x)/2)^2 + 1)) + log(tan(a/2 + (b*x)/2))/b

________________________________________________________________________________________